package com.lottery.dto;

import java.io.Serializable;

public class PageDto implements Serializable {

	private static final long serialVersionUID = -3198048449643774660L;

	private int pageNow = 1; // 当前页数

	private int pageSize = 5; // 每页显示记录的条数

	private int totalCount; // 总的记录条数

	private int totalPageCount; // 总的页数

	private int startPage; // 开始位置，从0开始

	private int type; // 类型

	public PageDto() {
		super();
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	/**
	 * 取得总页数，总页数=总记录数/总页数
	 * 
	 * @return
	 */
	public int getTotalPageCount() {
		totalPageCount = getTotalCount() / getPageSize();
		return (totalCount % pageSize == 0) ? totalPageCount : totalPageCount + 1;
	}

	/**
	 * 获取总页数totalPageCount
	 * 
	 * @param totalPageCount
	 */
	public void setTotalPageCount(int totalPageCount) {
		this.totalPageCount = totalPageCount;
	}

	public int getPageNow() {
		return pageNow;
	}

	/**
	 * 获取当前页pageNow
	 * 
	 * @param pageNow
	 */
	public void setPageNow(int pageNow) {
		this.pageNow = pageNow;
	}

	public int getPageSize() {
		return pageSize;
	}

	/**
	 * 获取每页记录的条数
	 * 
	 * @param pageSize
	 */
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotalCount() {
		return totalCount;
	}

	/**
	 * 获取总的记录数
	 * 
	 * @param totalCount
	 */
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	/**
	 * 取得选择记录的初始位置
	 * 
	 * @return
	 */
	public int getstartPage() {
		return (pageNow - 1) * pageSize;
	}

	public void setstartPage(int startPage) {
		this.startPage = startPage;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return "[" + "pageNow:" + pageNow + ", pageSize:" + pageSize + ", totalCount:" + totalCount
				+ ", totalPageCount:" + totalPageCount + ", startPage:" + startPage + "]";
	}

}
